package fangwenzhe;

public class Idler implements Visitor {//闲人
    private String name;
    public Idler(String name) {
        this.name = name;
    }
    @Override
    public void visit(Music music) {//传入 受访问者对象
        System.out.println(name + "浏览音乐网站：" + music.getName());
        music.playMusic();//调用受访问者方法
    }
    @Override
    public void visit(Video video) {
        System.out.println(name + "浏览视频网站：" + video.getName());
        video.playVideo();
    }
}